package com.imut.hcdp.controller;

import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.imut.hcdp.domain.HcdpSeatTypePrice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


import com.imut.hcdp.common.Rst;

import com.imut.hcdp.domain.HcdpStation;
import com.imut.hcdp.service.IHcdpStationService;



@RestController
@RequestMapping("/system/station")
public class HcdpStationController
{
    @Autowired
    private IHcdpStationService hcdpStationService;



    @GetMapping("/list")
    public Rst list(HcdpStation hcdpStation, HttpServletRequest request)
    {
//        String pageNum = request.getParameter("pageNum");
//        String pageSize = request.getParameter("pageSize");
//        PageHelper.startPage(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
        List<HcdpStation> list = hcdpStationService.selectHcdpStationList(hcdpStation);
//        PageInfo<HcdpStation> pageInfo = (PageInfo<HcdpStation>)list;
        return Rst.success(list);
    }





    @GetMapping(value = "/{id}")
    public Rst getInfo(@PathVariable("id") Long id)
    {
        return Rst.success(hcdpStationService.selectHcdpStationById(id));
    }




    @PostMapping
    public Rst add(@RequestBody HcdpStation hcdpStation)
    {
        return Rst.success(hcdpStationService.insertHcdpStation(hcdpStation));
    }




    @PutMapping
    public Rst edit(@RequestBody HcdpStation hcdpStation)
    {
        return Rst.success(hcdpStationService.updateHcdpStation(hcdpStation));
    }




	@DeleteMapping("/{ids}")
    public Rst remove(@PathVariable Long[] ids)
    {
        return Rst.success(hcdpStationService.deleteHcdpStationByIds(ids));
    }
}
